home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_218 / edlib / bintoint.c < prev    next >
Text File  |  1992-05-06  |  507b  |  22 lines

  1. /*
  2.  * edlib v1.1 Copyright 1989 Edwin Hoogerbeets
  3.  * This code is freely redistributable as long as no charge other than
  4.  * reasonable copying fees are levied for it.
  5.  */
  6.  
  7. /* this function takes a string of binary digits and returns its value */
  8. int bintoint(number)
  9. register char *number;
  10. {
  11.     register int value = 0;
  12.  
  13.     while ( *number )
  14.         if ( isbdigit(*number) ) {
  15.             value = (value << 1) + toint(*number++);
  16.         } else {
  17.             return(value);
  18.         }
  19.  
  20.     return(value);
  21. }
  22.